<?php
class User extends CI_Model {
	public function __construct() {
        parent::__construct();
	}
	public function get($intId) {	
		
		$stmt = $this->db->conn_id->prepare('CALL sp_getUserFromId(?)');//prepare the query
		$stmt->bindParam(1, $intId, PDO::PARAM_INT, 11);//assign params
		$stmt->execute();
		return $stmt->fetch();	
	}
	public function insert($strUser,$strPassword)
	{
		$stmt = $this->db->conn_id->prepare('CALL sp_insertUser(?,?)');
		$stmt->bindParam(1,$strUser,PDO::PARAM_STR,30);
		$stmt->bindParam(2,md5($strPassword),PDO::PARAM_STR,32);
		$stmt->execute();
	}
	public function getAll() {	
		$stmt = $this->db->conn_id->prepare('CALL sp_getAllUser()');//prepare the query		
		$stmt->execute();//execute query
		return $stmt->fetchAll();
	}
}